'use strict';(()=>{function p(a,b){return c=>$(`<div>&nbsp; Mode: ${_ow(b,c.params[a],a,"number")} <h h=${"mode"}></h></div>`)}function x(a,b,c){c=_4u(c,"tse").add({other:"Other tab... <edit></edit>"});a=$(_Qp(c,a,_Mg(b)?"other":b));_Mg(b)&&a.prop("value",b);return a}function t(a){$(a).on("change","[name=baseMonitor]",function(){$(this).attr("value",this.value)}).on("click","preview",function(){_oe(a)}).on("close",function(){_2j(this)})}let e=document.currentScript.parentElement.paramsGuiGen={};e.activateTabs=
function({params:a}){return $(`<div><label>${_io("peek",a.peek)}Keep MRU order</label> <h h=pk></h></div>`)};e.close=function({params:a}){return $(`<div>Switch to: ${_Qp({"":"(default behavior)"}.add(_4u(["prevUsedTab","leftTab","rightTab"],"tse")),"switchTo",a.switchTo||"")} <h h=swto></h></div>`)};e.closeTabs=function({params:a}){let b={"":["(default behavior)","dft"]}.add(_4u("prevUsedTab openerTab leftTab rightTab firstTab lastTab".split(" "),"tse"));b=JSON.parse(JSON.stringify(b).replace(/\/tse\//g,
""));return $(`\n <div><l>Switch to:</l> ${_Qp(b,"switchTo",a.switchTo||"")} <h h=swto></h></div>\n <div><l>Keep open:</l> ${_ow({"":"None",lastWin:"Last window",anyWin:"Any window"},a.keepWin,"keepWin")} <h h=kpW></h></div>\n `)};e.openNTP=function({params:a}){return $(`<div>&nbsp;${_ow({ntp:"Default page",blank:"Blank page"},a.page,"page")} <h h=pg></h></div>`)};e.muteTabs=p("mode",[[_be,"Mute"],[_Bf,"Unmute"],[_up,"Toggle"]]);e.pinTabs=p("mode",[[_be,"Pin"],[_Bf,"Unpin"],[_up,"Toggle"]]);e.reloadTabs=
p("force",{0:"Normal reload",1:"Hard reload"});e.highlightTabs=function({params:a}){return $(`\n <div>&nbsp; Mode: ${_ow([[_be,"Select"],[_Bf,"Unselect"],[_up,"Toggle"]],a.mode,"mode","number")} <h h=mode></h></div>\n <div><label>${_io("inclActTab",a.inclActTab)}Include active tab</label> <h h=actT></h></div>\n `)};e.zoomTabs=function({params:a},b){a=_Lo(`\n <div>\n <l>Type:</l> ${_ow([[1,"Zoom in (proportional)"],[2,"Zoom in (fixed)"],[-1,"Zoom out (proportional)"],[-2,"Zoom out (fixed)"],["custom",
"Custom zoom"],[0,"Reset to default"]],a.type,"type")}\n <h h=tpe></h>\n </div>\n <div rel><l>Amount:</l> ${_ow({1:"5 %",2:"10 %",3:"15 %",4:"20 %",5:"27 %",6:"35 %"},a.steps,"steps","number")} <h h=rel></h></div>\n <div fix><l>Amount:</l> <input type=number name=amount value="${a.amount||5}" min=1 max=100>points <h h=fix></h></div>\n <div cust><l>Amount:</l> <input type=number name=amount value="${a.amount||100}" min=10 max=800 step=5><unit>%</unit> <h h=cst></h></div>\n <div><l>Scope:</l> ${_ow({0:"Domain",
1:"Tab"},a.perTab,"perTab","bool")} <h h=scp></h></div>\n `);$("[name=type]",a).on("change",function(c,d=b){$("div[rel]",d).toggle(1==Math.abs(+this.value));$("div[fix]",d).toggle(2==Math.abs(+this.value));$("div[cust]",d).toggle("custom"==this.value)}).trigger("change",a);return a};const u="currentTab prevUsedTab openerTab hoveredTabs eventTabs leftTab rightTab firstTab lastTab".split(" "),C=_4u(u,"tse").add({other:"Other tab... <edit></edit>"});e.loadUrls=e.openBookmarks=function(a,b){let c=a.params,
d=c.tabPos||"",f=_Mg(c.refTab)?"other":c.refTab;a=_Bj(_Lo)`\n ${"loadUrls"==a.action?`\n <div> <btnFld popupAround>${_if("url",c.url,"Enter a URL...","field autoDim")}<b button></b>\n </btnFld> <h h=url></h>\n <par name=usesTabs value="${c.usesTabs||""}" bool></par>\n </div>\n `:_Bj`\n <div>${_Hy("bookmarkId",c.bookmarkId||"")}</div>\n `}\n <div>\n <l>Open on:</l> ${_Qp({"":["Existing tab","opnTgtTbs"],before:["The left of","../opnOnLft"],after:["The right of","../opnOnRgt"],newWin:"New window"},
"tabPos",d)}\n ${_Qp(C,"refTab",f||"currentTab")}\n <newTabs><label>${_io("newTabs",c.newTabs)}Create tabs if needed</label> <h h=nwTb></h></newTabs>\n </div>\n <div winType>\n <l>Win type:</l> ${_ow({normal:"Normal",popup:"Pop-up"},c.winType,"winType")}\n <label>${_io("incognito",c.incognito)}Incognito</label> <h h=../loadUrls/icgn></h>\n </div>\n `;_Mg(c.refTab)&&$("[name=refTab]",a).prop("value",c.refTab);$("[name=tabPos]",a).on("change",function(g,h=b){g=$(this).attr("value");$("[name=refTab]",
h).css("display",g.in("before","after")?"":"none");$("[winType]",h).css("display","newWin"==g?"":"none");$("newTabs",h).css("display",g?"none":"")}).trigger("change",a);$("btnFld",a).on("input",function(g){$(this).siblings("par").val(_hf._6i(g.target.value))});_hs($("btnFld",a),"b)t)r<l<","url domn mdom path dPth qry frag tit sltn ombar clbrd exClb1 clbLns dir env".split(" "));return a};e.bookmarkUrls=e.bookmarkTabs=function(a){var b=a.params;a="bookmarkUrls"==a.action;b=_Bj`\n <div><l>Dest. folder:</l> ${_Hy("parentId",
b.parentId||"",!0)} <h h=flr></h></div>\n <div><l>Name:</l> <btnFld popupAround>${_if("path",b.path,a?"":"Optional name pattern...","field autoDim")}<b button></b></btnFld> <h h=pth></h></div>\n ${a?`\n <div><l>URL:</l> <btnFld popupAround>${_if("url",b.url,"","field autoDim")}<b button></b></btnFld> <h h=url></h></div>\n <par name=usesTabs value="${b.usesTabs||""}" bool></par>\n `:""}\n <div><l>Insertn order:</l> ${_ow({date:"Creation date",name:"Name",url:"URL"},b.order,"order")}\n ${_ow({asc:"Ascending",
desc:"Descending"},b.ordDir,"ordDir")} <h h=ord></h></div>\n <div><l></l> ${_ow({folder:"Folders first",bkmrk:"Bookmarks first",none:"Intersperse"},b.prior,"prior")} <h h=pri></h></div>\n <div><l>If exists:</l> ${_ow({keep:"Do nothing",updt:"Update",repl:"Replace"},b.ifExists,"ifExists")} <h h=ifEx></h></div>\n `;const c=$("[name=path]",b);if(a){const d=$("[name=url]",b);$("btnFld",b).on("input",function(){$(this).parent().siblings("par").val(_hf._6i(c.val())||_hf._6i(d.val()))});_hs(d.parent(),"b)t)r<l<",
"url domn mdom path dPth sltn clbrd exClb1".split(" "))}_hs(c.parent(),"b)t)r<l<","tit domn mdom path dPth sltn clbrd exClb1 date".split(" "));return b};e.moveTabs=function({params:a}){return _Bj($)`\n <div>\n &nbsp; Move to: ${_Qp({newWin:"New window",before:["the left of","bef"],after:["the right of","aft"]},"pos",a.pos||"newWin")}\n ${x("refTab",a.refTab||"currentTab",u)}\n ${""}\n </div>\n `.find("[name=pos]").change(function(){$(this).nextAll().css("display","newWin"==_pu(this)?"none":"")}).triggerEvt("change").end()};
e.groupTabs=function({params:a}){return _Bj($)`\n <div>&nbsp; Add to: ${_Qp({new:["New group","nw"],no:["No group","no"],before:["The left of","lf"],after:["The right of","rt"]},"target",a.target||"new")} ${x("refTab",a.refTab||"currentTab",u)} <h h=rfTb></h></div>\n <div><label>${_io("noNewGrp",a.noNewGrp)}Only if reference tab is grouped</label> <h h=nNg></h></div>\n `.find("[name=target]").change(function(){$(this).nextAll().add($(this).closest("div").next()).css("display",_pu(this).in("new","no")?
"none":"")}).triggerEvt("change").end()};e.undoClose=function({params:a}){let b=a.urlTest||{};return $(`\n <div>\n &nbsp;Reopen type: ${_ow({"":"Any",tab:"Tabs",win:"Windows"},a.objType,"objType")} <h h=typ></h> &nbsp; &nbsp; &nbsp; &nbsp;\n Amount: <input type=number name=maxObjs value=${a.maxObjs||1} min=1 max=99> <h h=amn></h>\n </div>\n <div ${"win"==a.objType?"greyedout":""}>\n <label>${_io("currWinTabs",a.currWinTabs)}Tabs in current window only</label>  <h h=curW></h>\n </div>\n <div name=urlTest value={}>&nbsp;Domain:\n ${_ow({0:"does",
1:"doesn't"},b.negate,"negate","bool")}\n ${_ow({equals:"match exactly",contains:"contain",starts:"start with",ends:"end with"},b.type,"type")}\n ${_if("value",b.value,"Enter text","size=15")} <h h=flt></h>\n </div>\n `).find("[name=objType]").change(function(){$(this).closest("div").parent().find("[name=currWinTabs]").closest("div").attr("greyedout","win"==this.value?"":null)}).end()};e.favoriteTabs=function({params:a}){return`\n <div><l>Favorite list:</l> ${_ow(_kp,a.listId,"listId")}  <h h=lst></h></div>\n <div><l>Operation:</l> ${_ow({add:"Add",
set:"Set",del:"Remove"},a.oper,"oper")} <h h=opr></h></div>\n `};const v={gridLayout:"grid2x2",animDuration:.3};e.moveResizeWins=function(a,b){let c=v.sc().add(a.params);a=d=>{let f=!c[d]||+_Kg(c,d,"abs"),g=_Kg(c,d,"val");return`<input type=number name="${d}.val" value="${null!=g?g:""}" step=${({px:10,tile:1,"%":5})[c.unit]} min="${f&&d.in("w","h")?1:""}"> `+_ow([[1,"absolute"],[0,"relative"]],f,d+".abs","number")};t(b);$(b).on("focus change","[name=unit]",function(){this.prevValue=this.value}).on("input",
"[name=unit]",function(){let d=_To(b,!0);$("[name=gridLayout]",b).closest("div").attr("greyedout","tile"!=d.unit?"":null);let f=b.previewPane?$("select",b.previewPane).val():_hf._Pd;$("[name$=val]",b).each((g,h)=>{h.value&&(h.value=_6r(h.value,h.name[0],this.prevValue,d.unit,d,f),h.min&&(h.value=Math.max(h.value,h.min)));h.step={px:10,tile:1,"%":5}[d.unit]})}).on("change","[name='w.abs'], [name='h.abs']",function(){$(this).prevAll("[type=number]")[0].min=+this.value?1:""});return _Bj`\n ${_Ft()}\n <div><l>Unit:</l> ${_ow({px:"Pixels",
tile:"Tiles","%":"%"},c.unit,"unit")} <h h=uni></h></div>\n <div ${"tile"!=c.unit?"greyedout":""}><l>Layout:</l> ${_bg("gridLayout","gridLayout",c.gridLayout)}</div>\n <div><l>X:</l> ${a("x")} <h h=x></h></div>\n <div><l>Y:</l> ${a("y")} <h h=y></h></div>\n <div><l>Width:</l> ${a("w")} <h h=w></h></div>\n <div><l>Height:</l> ${a("h")} <h h=h></h></div>\n ${1<Object.keys(_hf._h).length?`\n <div><l>w.r.t.:</l> ${_ow([["","Containing monitor"]].concat(_2e()),c.baseMonitor,"baseMonitor",`value="${c.baseMonitor||
""}"`)} <h h=mon></h></div>\n `:""}\n <div><l>Animate:</l> <input type=number name=animDuration value="${c.animDuration}" min=0 max=10 step=0.1> secs <h h=../tileWins/ani></h></div>\n `};e.fitWinsToGrid=function(a,b){a=v.sc().add(a.params);t(b);return _Bj`\n ${_Ft()}\n <div><l>Layout:</l> ${_bg("gridLayout","gridLayout",a.gridLayout)}</div>\n <div><l>Animate:</l> <input type=number name=animDuration value="${a.animDuration}" min=0 max=10 step=0.1> secs <h h=../tileWins/ani></h></div>\n <par name=unit value=tile></par>\n `};
e.tileWins=function(a,b){a=v.sc().add(a.params);t(b);return _Bj`\n ${_Ft()}\n <div><l>Layout:</l> ${_bg("gridLayout","gridLayout",a.gridLayout)}</div>\n <div><l>X:</l> <input type=number name=x value="${a.x||""}"> <h h=x></h></div>\n <div><l>Y:</l> <input type=number name=y value="${a.y||""}"> <h h=y></h></div>\n <div><l>Cols:</l> <input type=number name=cols value="${a.cols||""}" min=1 max=20> <h h=c></h></div>\n <div><l>Rows:</l> <input type=number name=rows value="${a.rows||""}" min=1 max=20> <h h=r></h></div>\n ${1<
Object.keys(_hf._h).length?`\n <div><l>w.r.t.:</l> ${_ow([["","Containing monitor"]].concat(_2e()),a.baseMonitor,"baseMonitor",`value="${a.baseMonitor||""}"`)} <h h=mon></h></div>\n `:""}\n <div><l>Animate:</l> <input type=number name=animDuration value="${a.animDuration}" min=0 max=10 step=0.1> secs <h h=ani></h></div>\n `};e.minimizeWins=function({params:a}){return $(`\n <div>\n ${_ow([[_be,"Minimize"],[_Bf,"Unminimize"],[_up,"Toggle"]],a.mode,"mode","number")}\n <h h=mod></h>\n </div>\n <div><label>${_io("noAnim",
a.noAnim)}No animation</label> <h h=../noAnim></h></div>\n `)};e.maximizeWins=function({params:a}){return $(`\n <div>\n ${_ow([[_be,"Maximize"],[_Bf,"Unmaximize"],[_up,"Toggle"]],a.mode,"mode","number")}\n <h h=mod></h>\n </div>\n <div><label>${_io("noAnim",a.noAnim)}No animation</label> <h h=../noAnim></h></div>\n `)};e.restoreWins=function({params:a}){return $(`<div><label>${_io("noAnim",a.noAnim)}No animation</label> <h h=../noAnim></h></div>`)};e.focusWin=function({params:a},b){a=$(_Lo(`\n <div>&nbsp; Mode: ${_ow([[_be,
"Focus"],[_Bf,"Unfocus"],[_up,"Toggle"]],a.mode,"mode","number")} <h h=mode></h></div>\n <div><label>${_io("peek",a.peek)}Keep MRU order</label> <h h=pk></h></div>\n `));$("[name=mode]",a).change(function(c,d=b){$("[name=peek]",d).closest("div").attr("greyedout",this.value==_Bf?"":null)}).trigger("change",a);return a};e.fullscreenWins=p("mode",[[_be,"Fullscreen"],[_Bf,"Normal"],[_up,"Toggle"]]);e.hideWins=p("mode",[[_be,"Hide"],[_Bf,"Unhide"],[_up,"Toggle"]]);e.topmostWins=p("mode",[[_be,"Topmost"],
[_Bf,"Not topmost"],[_up,"Toggle"]]);e.scrollWins=function({params:a},b){a.oldMethod&&(a.method="old");return $(_Lo(`\n <div><l>Direction:</l> ${_ow({up:"Up",down:"Down",left:"Left",right:"Right"},a.dir,"dir")}</div>\n <div><l>Amount:</l> <input type=number name=amount value="${a.amount||1}" min=1 max=250> <h h=amn></h></div>\n <div><l>Method:</l> ${_ow({"":"Standard scroll",wheel:"Wheel turn",old:"Legacy scroll"},a.method,"method")} <h h=mtd></h></div>\n <div><label>${_io("keepModKeys",a.keepModKeys)}Keep modifier keys state</label> <h h=kms></h></div>\n <div><label>${_io("pointedElem",
a.pointedElem)}Apply to hovered element</label> <h h=pnt></h></div>\n `))};e.openMenu=function({params:a}){return _Bj`\n <div><l>Menu to open:</l> ${_bg("menuSpec","menuId",a.menuId)} <h h=mnu></h></div>\n <div><l>Position:</l> ${_Gh(a,!0)} <h h=pos></h></div>\n <div><l>Alignment:</l> ${_zk(a,!0)} <h h=alg></h></div>\n <div><l>Style:</l> ${_lu(a)} <h h=sty></h></div>\n `};e.closeMenu=function({params:a}){return _Bj`<div>Menu to close: ${_bg("menuSpec","menuId",a.menuId,"&nbsp;",!0,!1)} <h h=mnu></h></div>`};
e.moveSelectMark=function({params:a},b){$(b).on("input","[name=dir]",function(){+this.value||(this.value=0<this.defaultValue?-1:1);this.defaultValue=this.value});return _Bj`\n <div><l>Menu:</l> ${_bg("menuSpec","menuId",a.menuId,"&nbsp;",!0,!1)} <h h=mnu></h></div>\n <div><l>Step:</l> <input type=number name=dir value="${a.dir||1}"> <h h=dir></h></div>\n `};e.selectMarkedItem=function({params:a}){return _Bj`\n <div><l>Menu:</l> ${_bg("menuSpec","menuId",a.menuId,"&nbsp;",!0,!1)} <h h=mnu></h></div>\n <div><l>Which item:</l> ${_ow({marked:"Marked",
hilited:"Highlighted",hovered:"Hovered"},a.markType,"markType")} <h h=mkT></h></div>\n <div><l>Method:</l> ${_ow({0:"Normal",1:"Secondary 1",2:"Secondary 2"},a.selMode,"selMode","number")} <h h=mde></h></div>\n `};e.runCommand=function({params:a},b){a=_Bj`\n <div>\n <l>File path:</l> <btnFld popupAround>${_eu("cmd",a.cmd,"Enter a file or command...","","","autoDim")}<b button></b></btnFld> <h h=cmd></h>\n <par name=usesTabs value="${a.usesTabs||""}" bool></par>\n </div>\n <div>\n <label>${_io("showCmd",
a.showCmd)}Show CMD window</label> <h h=sh></h> &nbsp;\n <label>${_io("keepCmd",a.keepCmd)}Keep CMD window</label> <h h=kp></h>\n </div>\n `;$("btnFld",a).on("input",function(c){$(this).siblings("par").val(_hf._6i(c.target.value))});$("[name=showCmd]",a).on("change",function(c,d=b){$("[name=keepCmd]",d).closest("label").next().addBack().css("display",this.checked?"":"none")}).trigger("change",a);_hs($("btnFld",a),"b)t)r<l<","tit url domn mdom path dPth qry frag sltn ombar clbrd exClb1 clbLns clbWrd date dir env".split(" "));
return a};let m=()=>[["","System clipboard"]].concat([1,2,3,4,5].map(a=>[a,"Extra clipboard "+a]));e.insertText=e.clpbrdPut=function({params:a,action:b}){b="clpbrdPut"==b;a=$(_Lo(`\n <div txtTmplExpr>\n <textarea field name=text placeholder="Enter text..." spellcheck=false>${_5h(a.text||"")}</textarea>\n <side><b button>&#x25BE;</b> <h h=txt></h></side>\n <par name=usesTabs value="${a.usesTabs||""}" bool></par>\n </div>\n ${b?`\n <div style="margin: 4px 0">&nbsp; Put text in: ${_ow(m(),a.target,"target")} <h h=tgt></h></div>\n `:
""}\n <div>\n <label>${_io("verbatim",a.verbatim)}Verbatim text</label> <h h=vbm></h>\n ${b?`\n &nbsp; &nbsp; &nbsp; <label>${_io("append",a.append)}Append</label> <h h=apn></h>\n `:`\n <!--div><label>${_io("paste",a.paste)}Insert by pasting</label> <h></h></div-->\n `}\n </div>\n `));_hs($("[txtTmplExpr]",a),"brtl","tit url domn mdom path dPth sltn ombar obWrd clbrd exClb1 clbLns clbWrd date dir env".split(" "));let c=()=>_3e(d,!0),d=$("[name=text]",a).on("input",function(){$(this).siblings("par").val(_hf._6i(this.value));
_3e(d,!0)})[0];return a.prop("onInsert",()=>c)};e.txtToUrl=function({params:a}){_Pt(a)&&(a={urlTmpl:"google.com/search?q=<text>",prtcol:"http"});a=$(_Lo(`\n <div><l>Text:</l> <btnFld multi><textarea field name=text spellcheck=false>${_5h(a.text||"")}</textarea><b button></b></btnFld> <h h=txt></h></div>\n <div><l>Protocol:</l> ${_if("prtcol",a.prtcol)} <h h=prot></h> &nbsp; &nbsp; &nbsp;<label>${_io("www",a.www)}Add "www"</label> <h h=w3></h></div>\n <div><l>Template:</l> <btnFld popupAround>${_if("urlTmpl",
a.urlTmpl,"","field autoDim")}<b button></b></btnFld> <h h=tmpl></h>\n <par name=usesTabs value="${a.usesTabs||""}" bool></par></div>\n <div><l>Save to:</l> ${_ow(m(),a.tgtCbrd,"tgtCbrd")} <h h=tgt></h></div>\n `));$("[name=urlTmpl]",a).on("input",function(d){$(this).parent().siblings("par").val(_hf._6i(d.target.value))});_hs($("[name=text]",a).parent(),"brtl","sltn ombar obWrd clbrd exClb1 clbLns clbWrd dir env".split(" "));_hs($("[name=urlTmpl]",a).parent(),"b)t)r<l<","txt sltn ombar clbrd clbWrd url domn mdom path dPth qry frag date dir env".split(" "));
let b=()=>_3e(c,!0),c=$("[name=text]",a).on("input",b)[0];return a.prop("onInsert",()=>b)};e.extractURLs=function({params:a}){let b=_Pt(a)?"":"text"in a?a.text:`<clipboard${a.target|0?`(${a.target|0})`:""}>`;a=$(_Lo(`\n <div><l>Source text:</l> <btnFld multi><textarea field name=text spellcheck=false>${_5h(b)}</textarea><b button></b></btnFld> <h h=txt></h></div>\n <div><l>Save to:</l> ${_ow(m(),a.target,"target")} <h h=tgt></h></div>\n `));_hs($("btnFld",a),"brtl","sltn ombar obWrd clbrd exClb1 clbLns clbWrd".split(" "));
let c=()=>_3e(d,!0),d=$("[name=text]",a).on("input",c)[0];return a.prop("onInsert",()=>c)};e.delDupLines=function({params:a}){return`<div> &nbsp; ${_ow(m(),a.target,"target")} <h h=tgt></h></div>`};e.copyLinks=function({params:a}){return`\n <div> <iblock><label>${_io("lnk",a.lnk||_Pt(a))}Links</label> <br>\n <label>${_io("img",a.img)}Images</label> &nbsp; </iblock>\n <iblock><label>${_io("vid",a.vid)}Videos</label> &nbsp; &nbsp;\n <label>${_io("aud",a.aud)}Audio</label> <br>\n <label>${_io("imgRes",
a.imgRes)}Graphic resources</label> </iblock>\n &nbsp; <h h=tpe></h></div>\n <hr>\n <div><l>Copy to:</l> ${_ow(m(),a.clpbrd,"clpbrd")} &nbsp; <h h=tgt></h></div>\n `};e.copyElemUrl=function({params:a}){return $(`\n <div type><l>Element type:</l> <label>${_io("lnk",a.lnk)}Link</label> &nbsp;\n <label>${_io("mda",a.mda)}Media</label> &nbsp;\n <label>${_io("frm",a.frm)}Frame</label> &nbsp; <h h=tpe></h></div>\n <div><label>${_io("smart",a.smart)}Use smart detection</label> <h h=smt></h></div>\n <div><l>Copy to:</l> ${_ow(m(),
a.target,"target")} <h h=tgt></h></div>\n `).filter("div[type]").on("click","[type=checkbox]",function(b){$(this).closest("div").find(":checked").length||b.preventDefault()}).end()};e.openElemUrl=function({params:a}){return`<div>Element type: ${_ow({lnk:"Link",mda:"Media"},a.type,"type")} <h h=tpe></h></div>`};const y={silent:["Silent","sil"],audio:["Audible","aud"],notif:["Floating display","ntf","","perms=notf"],dwnlApi:["Dwnld manager","mgr","","perms=dwld"]};e.saveUrl=function({params:a},b){var c=
{rename:"Rename",overwrite:"Overwrite",ask:"Ask",cancel:"Cancel"};a=_Bj($)`\n <div><l>URL:</l> <btnFld popupAround>${_if("url",a.url,"URL to save...","field autoDim")}<b button></b></btnFld> <h h=url></h></div>\n <div><l>Folder:</l> <btnFld popupAround>${_eu("folder",a.folder,"Destination... (optional)","DIR","","autoDim")}<b button></b></btnFld> <h h=dir></h></div>\n <div><l>Filename:</l> <btnFld popupAround>${_if("file",a.file,"(optional)","field autoDim")}<b button></b></btnFld> <h h=fnm></h></div>\n <par name=usesTabs value="${a.usesTabs||
""}" bool></par>\n <div><l>Method:</l> ${_Qp(y,"method",a.method||"silent")} &nbsp; &nbsp; &nbsp; &nbsp;\n <label>${_io("showSaveAs",a.showSaveAs)}Show "Save as..."</label> <h h=svas></h>\n </div>\n <!--dWrap-->\n <div inln><l>If file exists:</l> ${_ow(c,a.ifFileExist,"ifFileExist")}</wrap> <h h=flEx></h></div> &nbsp;\n <div inln>If name exists:   ${_ow(c,a.ifNameExist,"ifNameExist")} <h h=nmEx></h></div>\n <!--/dWrap-->\n <div><l>When done:</l> ${_ow({"":"Do nothing",open:"Open file",openDir:"Show in folder",
copy:"Copy file path"},a.doAtEnd,"doAtEnd")}\n <tgtClpbrd>&nbsp; to: ${_ow(m(),a.tgtClpbrd,"tgtClpbrd")}</tgtClpbrd> <h h=end></h>\n </div>\n `;const d=$("[name=url]",a)[0],f=$("[name=folder]",a)[0],g=$("[name=file]",a)[0],h=$("[name=usesTabs]",a);$("btnFld",a).on("input",function(){h.val(_hf._6i(d.value)||_hf._6i(f.value,!0)||_hf._6i(g.value,!0))});$("[name=doAtEnd]",a).on("change",function(){$(this).nextAll("tgtClpbrd").toggleClass("noDisplay","copy"!=this.value)}).trigger("change");$("[name=method]",
a).on("change",function(q,r=b){$("[name=ifFileExist]",r).closest("div").attr("greyedout","dwnlApi"==_pu(this)?"":null)}).trigger("change",a);c="domn mdom path dPth prot qry frag sltn ombar clbrd exClb1".split(" ");_hs(d.closest("btnFld"),"b)t)r<l<",["url",...c,"clbLns"]);_hs(f.closest("btnFld"),"b)t)r<l<",["tit",...c,"date","dir","env"]);_hs(g.closest("btnFld"),"b)t)r<l<",["fname","fext","tit",...c,"date"]);return a};e.saveElemUrl=function({params:a}){return _Bj`\n <div><l>Folder:</l> ${_eu("folder",
a.folder,"(optional)","DIR","","autoDim")} <h h=dir></h></div>\n <div><l>Method:</l> ${_Qp(y.sc().del("silent"),"method",a.method||"audio")}</div>\n `};e.setVolume=function({params:a},b){a=$(_Lo(`\n <div><l>Scope:</l> ${_ow({":sys":"Global volume",":brwr":"Browser volume"},a.target,"target")} <h h=scp></h></div>\n <div><l>Mode:</l> ${_ow({set:"Set to",up:"Increase by",down:"Decrease by",mute:"Mute",unmute:"Unmute",toggle:"Toggle mute"},a.mode,"mode")}</div>\n <div><l>Amount:</l> <input type=number name=value value=${null!=
a.value?a.value:100} min=0 max=100 step=5></div>\n `));$("[name=mode]",a).change(function(c,d=b){$("[name=value]",d).closest("div").attr("greyedout",this.value.in("set","up","down")?null:"")}).trigger("change",a);return a};e.sendInput=_Er;e.stopSendInput=_8;e.runScript=_wj(function*(a,b){a=yield _5k(a.params);a.onInsert=()=>_3e($("textarea",b)[0],!1,[700,-30],[400,-170]);$(b).on("input","textarea",a.onInsert);return a});e.brkActSeq=function({params:a}){let b=a.oper?[{type:"tgtTabs",comp:"ne"==a.oper?
"eq":a.oper,not:"ne"==a.oper,value:a.value}]:a.conds||[];const c={tgtTabs:f=>`\n ${_ow({0:"",1:"not"},f.not,"not","bool")}\n ${_ow({eq:"equal",lt:"less than",gt:"greater than"},f.comp,"comp")}\n <input type=number min=0 name=value value="${f.value|0}">\n `,swtchSt:f=>`\n ${_Ee("swtchId",f.swtchId)}\n ${_ow([[1,"is ON"],[0,"is OFF"]],f.state,"state","bool hard")}\n `,txtMtch:f=>`\n <btnFld popupAround>${_if("txt1",f.txt1,"Enter text...","field autoDim")}<b button></b></btnFld>\n ${_ow({0:"",1:"not"},
f.not,"not","bool")}\n ${_ow({equals:"equals",contains:"contains",starts:"starts with",ends:"ends with"},f.comp,"comp")}\n <par name=usesTabs value="${f.usesTabs||""}" bool></par>\n <btnFld popupAround>${_if("txt2",f.txt2,"Enter text...","field autoDim")}<b button></b></btnFld>\n `};let d=f=>`\n <div value={}>\n <del button title="Delete condition">&#xD7;</del>${_ow({tgtTabs:"If target tabs",swtchSt:"If switch",txtMtch:"If text"},f.type,"type")}: <wrap>${c[f.type](f)}</wrap> <h h=${f.type}></h> ${_ow({A:"AND",
O:"OR",E:"EQUAL"},f.oper,"oper")} <h h=oper></h>\n </div>\n `;a=_Lo(`\n <div><l>Action:</l> ${_ow({contChn:"Continue chain",stopChn:"Stop chain",stopSeq:"Stop entire sequence"},a.action,"action")} <h h=act></h></div>\n <conds name=conds value=[]>${b.map(d).join("")}</conds>\n <div><add>Add condition</add> <h h=adCnd></h></div>\n `);$("add",a).on("click",function(){let f=$(this).closest("div").siblings("conds"),g=f.find("> :last-child [name=type]").prop("value")||"tgtTabs";f[0].insertAdjacentHTML("beforeend",
d({type:g}));$(this).triggerEvt("change",!0)});$("> conds",a).on("change","[name=type]",function(){_rg($(this).closest("div"))&&_dj(700);$(this).closest("div").replaceWith(d({type:this.value}))}).on("dblclick","del",function(){_rg($(this).closest("div"))&&_dj(500);$(this).closest("conds").triggerEvt("change",!0,!0);$(this).closest("div").remove()}).on("input","[type=text]",function(f){f=$(this).closest("wrap");let g=f.find("[type=text]");f.find("[name=usesTabs]").val(_hf._6i(g[0].value)||_hf._6i(g[1].value))});
_hs([$("> conds",a),"btnFld"],"b)t)r<l<","tit url domn mdom path dPth prot qry frag sltn ombar clbrd exClb1 dir env".split(" "));return a};e.setSwtchSt=function({params:a}){return`\n <div><l>Switch:</l> ${_Ee("swtchId",a.swtchId)} <h h=swt></h></div>\n <div><l>Action:</l> ${_ow([[1,"Turn ON"],[0,"Turn OFF"],[-1,"Toggle"]],a.state,"state","number")} <h h=act></h></div>\n `};e.wait=function({params:a},b){let c=[["time",["Fixed time lapse"]]];var d=[_sd,_vd,_Lr,_uw,_bs,_5f,_vf,_vw,_Qo,_j,_me,_8j,_ve,
_Yd,_vr,_6h,_Gp,_fd,_wh];for(let f of d)d=_Wr[f],c.push([f,[d.name,"/envEvts/"+d.help,f.in(_vd,_Yd)]]);a=_Lo(`\n <div><l>Wait for:</l> ${_Qp(c,"event",a.event||"time")} <h h=wfr></h></div>\n <div t=time><l>Time lapse:</l> <input type=number name=time value=${a.time||.5} min=0 step=0.1> secs <h h=tim></h></div>\n <div t=evt><l>Timeout:</l> <input type=number name=timeout value=${a.timeout||10} min=0> secs <h h=tmo></h></div>\n <div t=evt><l>If timeout:</l> ${_ow({contChn:"Continue chain",stopChn:"Stop chain",
stopSeq:"Stop entire sequence"},a.ifTmOut,"ifTmOut")} <h h=ifto></h></div>\n <div><label>${_io("sync",a.sync)}Postpone other actions</label> <h h=sync></h></div>\n `);$("[name=event]",a).change(function(f,g=b){$("div[t]",g).addClass("noDisplay").filter(`[t=${"time"==_pu(this)?"time":"evt"}]`).removeClass("noDisplay")}).trigger("change",a);return a};e.playAudio=_wj(function*({params:a,action:b},c){var d=(yield _hf._fw(_Fy))||{};const f=k=>_hf._Ji([{sequence:[{action:b,params:k}]}]);yield f({});const g=
{};for(let [k,l]of _hf._6d)g[k]=l.name;let h={};for(var q of yield _g())_ih(h,(q.lang||navigator.language).match(/^[^\-]*/)[0],[]).push(q);q={};for(let k of Object.keys(h))q[k]=Intl.DisplayNames?(new Intl.DisplayNames("en",{type:"language"})).of(k):k.caplze();d=_Bj`\n <div><l>Type:</l> ${_ow({preset:"Preset sound",system:"System sound",file:"Sound file",voice:"Speech"},a.type,"type")} <h h=typ></h></div>\n \n <div t=s><l>Sound:</l> ${_ow(d,a.evtAlias,"evtAlias")} <h h=evt></h></div>\n <div t=pq><l>Sound:</l> ${_ow(g,
a.sndId,"sndId")} </div>\n <div t=f><l>File:</l> ${_eu("file",a.file,"","Audio files: *.aac;*.aif;*.flac;*.m4a;*.mp2;*.mp3;*.ogg;*.oga;*.wav;*.wma;*.webm, All Files: *.*","","autoDim")} <h h=fle></h></div>\n \n <div t=p inln><l>Duration:</l> <input type=number name=len value="${a.len}" min=0 max=10 step=0.1> secs <h h=len></h></div>\n <div t=p inln>&nbsp; Pitch: <input type=number name=freq value="${a.freq}" min=10 max=15000 step=10> Hz <h h=frq></h></div>\n <div t=p></div>\n <div t=fqs><l>Duration:</l> <input type=number name=lenP value=${a.lenP||
100} min=10 max=1000 step=10> % <h h=lnp></h></div>\n <div t=fqsp inln><l>Times:</l> <input type=number name=times value=${a.times||1} min=1 max=50> <h h=tms></h> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>\n <div t=fqsp inln>&nbsp;Gap: <input type=number name=gap value=${a.gap||0} min=-100 max=500 step=5> % <h h=gap></h></div>\n <div t=fqsp></div>\n <div t=fqsp inln><l>Volume:</l> <input type=number name=vol value=${a.vol||100} min=0 max=500 step=10> % <h h=vol></h></div>\n <div t=fqsp inln>&nbsp;Balance: ${_ow({C:"Center",
L:"Left",R:"Right",LR:"Left to right",RL:"Right to left"},a.bal,"bal")} <h h=bal></h></div>\n \n <div t=v><l>Text:</l> <btnFld multi><textarea field name=text spellcheck=false>${_5h(a.text||"")}</textarea><b button></b></btnFld> <h h=txt></h>\n <par name=usesTabs value="${a.usesTabs||""}" bool></par></div>\n <div t=v><l>Language:</l> ${_ow(q,a.lang,"lang")} <h h=lng></h></div>\n <div t=v><l>Voice:</l> ${_ow([],"","voice","number")} </div>\n <div t=v inln><l>Pitch:</l> <input type=number name=pitch value=${a.pitch||
5} min=1 max=10> &nbsp; &nbsp; &nbsp; &nbsp; </div> \n <div t=v inln>Speed: <input type=number name=rate value=${a.rate||100} min=10 max=200 step=10> % </div>\n <div t=v><l>Volume:</l> <input type=number name=vol value=${a.vol||100} min=0 max=100 step=10> % </div>\n <div></div>\n <div inln><l>Play mode:</l> ${_ow({ovrlp:"Overlap",enque:"Enqueue",intrrp:"Interrupt"},a.mode,"mode")} <h h=mde></h></div>\n &nbsp; &nbsp; <btn test=play title="Test audio">&#9656;</btn><btn test=stop title="Stop test">&#9632;</btn>\n `;
let r=$("[name=type]",d)[0],z=$("[name=sndId]",d)[0],A=$("[name=text]",d)[0];$([r,z]).change(function(k,l=c,w=!0){k=r.value[0];let n=_hf._6d[z.value];"p"==k&&n.file&&(k="q");$("div[t]",l).addClass("noDisplay").filter(`[t*=${k}]`).removeClass("noDisplay");"preset"==r.value&&!n.file&&w&&($("[name=freq]",l).val(n.dfltFreq),$("[name=len]",l).val(n.dfltLen))}).trigger("change",[d,!a.freq]);$("[name=lang]",d).change(function(k,l=c,w=0){let n=$("[name=voice]",l)[0];n.options.length=0;(h[this.value]||[]).forEach((D,
B)=>n.options.add(new Option(D.name,B,!1,B==w)))}).trigger("change",[d,a.voice|0]);$("[name=times]",d).change(function(k,l=c){$("[name=gap]",l).closest("div").attr("greyedout",1==this.value?"":null)}).trigger("change",d);$(A).on("input",function(){_3e(this,!0);$("[name=usesTabs]",this.closest("div")).val(_hf._6i(this.value))});$("[test=play]",d).mousedown(()=>f(_Uu(c))());$("[test=stop]",d).mousedown(()=>f({mode:"intrrp"})());_hs($("[name=text]",d).parent(),"brtl","tit domn mdom sltn ombar clbrd exClb1".split(" "));
return $(d).prop("onInsert",()=>()=>$(A).triggerEvt("input"))});e.setMonBright=function({params:a}){let b=[["all","All monitors"],["focus","Focused monitor"],["mouse","Hovered monitor"]].concat([..._hf._h].map(([c,{name:d}])=>[c,d]));return`\n <div><l>Monitor:</l> ${_ow(b,a.monId,"monId")} <h h=mon></h></div>\n <div><l>Mode:</l> ${_ow({set:"Set to",up:"Increase by",down:"Decrease by"},a.mode,"mode")}</div>\n <div><l>Amount:</l> <input type=number name=level value=${null!=a.level?a.level:50} min=0 max=100 step=5> <h h=amn></h></div>\n `}})();
